import sys
from PyQt5.QtWidgets import *
app = QApplication(sys.argv)
# 创建Tablewidget实例
tablewidget = QTableWidget()
tablewidget.setColumnCount(4)
tablewidget.setRowCount(4)
#设置表头内容
tablewidget.setHorizontalHeaderLabels(["交易系统","账户ID","账户密码","系统路径"])
#获取表头内容
headerLabels =[]
for col in range(tablewidget.columnCount()):
    header = tablewidget.horizontalHeaderItem(col)
    if header is not None:
        headerLabels .append(header.text())
print(headerLabels)
tablewidget.show()
sys.exit(app.exec_())
